package com.hptpd.questionnairesurvey.repository;

import com.hptpd.questionnairesurvey.domain.Department;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * \* Created with IntelliJ IDEA.
 * \* Date: 2019/9/9
 * \*
 * \* Description:
 * \
 *
 * @author walter_long
 */
@Repository("departmentRep")
public interface DepartmentRep extends JpaRepository<Department, String> {
    /**
     * 根据ID找对象
     * @param id Integer
     * @return Department
     */
    Department findByIdIs(Integer id);

    /**
     * 根据父部门找子部门
     * @param department Department
     * @return List<Department>
     */
    List<Department> findByParentDepartmentIs(Department department);

    List<Department> findByParentDepartment_NameIsAndNameIs(String name, String name1);

    List<Department> findByName(String name);
}
